package fun.sanguo.mapper.sys;

import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import fun.sanguo.model.dto.PageQuery;
import fun.sanguo.model.entity.sys.SysUserEntity;
import fun.sanguo.utils.sqlBuilder.SqlBuilderSysUser;

import java.util.List;

/**
 * 用户信息表 Mapper接口
 *
 * @author ZYP
 * @date 2023-06-12
 */
@Mapper
public interface SysUserMapper {

    /**
     * 查询总量
     *
     * @param sysUserEntity
     * @return
     */
    @SelectProvider(type = SqlBuilderSysUser.class, method = "getTotal")
    int getTotal(SysUserEntity sysUserEntity);

    /**
     * 查询列表
     *
     * @param sysUserEntity
     * @param pageQuery
     * @return
     */
    @SelectProvider(type = SqlBuilderSysUser.class, method = "getList")
    List<SysUserEntity> getList(SysUserEntity sysUserEntity, PageQuery pageQuery);

    /**
     * 新增
     *
     * @param sysUserEntity
     * @return
     */
    @InsertProvider(type = SqlBuilderSysUser.class, method = "insert")
    Integer insert(SysUserEntity sysUserEntity);

    /**
     * 编辑
     *
     * @param sysUserEntity
     * @return
     */
    @UpdateProvider(type = SqlBuilderSysUser.class, method = "update")
    Integer update(SysUserEntity sysUserEntity);

    /**
     * 删除
     *
     * @param sysUserEntity
     * @return
     */
    @UpdateProvider(type = SqlBuilderSysUser.class, method = "delete")
    Integer delete(SysUserEntity sysUserEntity);

    /**
     * 获取最大用户编号
     *
     * @return
     */
    @SelectProvider(type = SqlBuilderSysUser.class, method = "generateUsercode")
    Integer generateUsercode();

    /**
     * 根据ID查询用户信息
     *
     * @param id
     * @return
     */
    @SelectProvider(type = SqlBuilderSysUser.class, method = "getById")
    SysUserEntity getById(String id);

    /**
     * 根据登陆账号查询用户信息
     *
     * @param username
     * @return
     */
    @SelectProvider(type = SqlBuilderSysUser.class, method = "getByUsername")
    List<SysUserEntity> getByUsername(String username);

    /**
     * 根据手机号码查询用户信息
     *
     * @param mobile
     * @return
     */
    @SelectProvider(type = SqlBuilderSysUser.class, method = "getByMobile")
    List<SysUserEntity> getByMobile(String mobile);

    /**
     * 修改密码
     *
     * @param sysUserEntity
     * @return
     */
    @InsertProvider(type = SqlBuilderSysUser.class, method = "updatePassword")
    Integer updatePassword(SysUserEntity sysUserEntity);
}